import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import Components from 'unplugin-vue-components/vite';
import {VantResolver} from 'unplugin-vue-components/resolvers';
import legacy from '@vitejs/plugin-legacy'
// https://vitejs.dev/config/
export default defineConfig({
    base: "./",
    plugins: [vue(),
        Components({
            resolvers: [VantResolver()],
        }),
        legacy({
            targets: ["last 1 version",
                "> 1%",
                "IE 10"]
        })
    ],
    resolve: {
        alias: {
            "@": path.resolve(__dirname, "src")
        }
    },
    server: {
        proxy: {
            "/api": {
                target: "http://114.132.154.30:8888",
                // target: "http://127.0.0.1:8888",
                changeOrigin: true,
                rewrite: path => path.replace(/^\/api/, "")
            }
        }
    },
    css: {
        // css预处理器
        preprocessorOptions: {
            less: {
                charset: false
            },
        },
    },
})
